package com.ruoyi.system.api.factory;

import com.ruoyi.system.api.RemoteMetricsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 文件服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteMetricsFallbackFactory implements FallbackFactory<RemoteMetricsService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteMetricsFallbackFactory.class);

    @Override
    public RemoteMetricsService create(Throwable throwable)
    {
        log.error("指标中心服务调用失败:{}", throwable.getMessage());
        return new RemoteMetricsService()
        {
            @Override
            public String health()
            {
                return "error";
            }
        };
    }
}
